package com.travelmood.controller;

import com.travelmood.pojo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/api/convert")
public class ConvertController {

    @PostMapping("/style")
    public Result convertStyle(@RequestBody Map<String, String> requestBody) {
        try {
            String photoUrl = requestBody.get("photoUrl");
            // Assume convertStyle makes an API call and updates the photo URL
            // Your implementation here
            // For example:
            // String newPhotoUrl = someConversionService.convertStyle(photoUrl);
            // return Result.success(newPhotoUrl);
            return Result.success(); // Placeholder response
        } catch (Exception e) {
            log.error("Error converting photo style:");
            return Result.error("Error converting photo style: " + e.getMessage());
        }
    }
}
